package com.wbw.ssb.controller;

import com.wbw.ssb.common.api.CommonResult;
import com.wbw.ssb.mbg.entity.Temperature;
import com.wbw.ssb.service.TemperatureService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

/**
 * @Author: guibo
 * @Description:
 * @Date: Created in 16:15 2021/5/25
 * @Modified By:
 */
@Api(tags = "温度管理")
@RestController
@RequestMapping("/temperature")
public class TemperatureController {
    @Autowired
    TemperatureService temperatureService;
    @ApiOperation("获取今天温度")
    @GetMapping(value = "/getToday")
    CommonResult<LinkedHashMap<String,Double>> getToday(@RequestParam Long granaryNumber){
        return CommonResult.success(temperatureService.getToday(granaryNumber));
    }
    @ApiOperation("获取当前温度")
    @GetMapping(value = "/getNow")
    CommonResult<Temperature> getNow(@RequestParam Long granaryNumber){
        return CommonResult.success(temperatureService.getNow(granaryNumber));
    }
}
